export default {
  func: {
    // 保留当前页面，跳到应用内的某个页面
    gonavigateTo(e) {
      wx.navigateTo({
        url: '../' + e.currentTarget.dataset.url + '/' + e.currentTarget.dataset.url
      })
    },
    // 跳转到 tabBar 页面，并关闭其他所有非 tabBar 页面
    goswitchTab(e) {
      wx.switchTab({
        url: '../' + e.currentTarget.dataset.url + '/' + e.currentTarget.dataset.url
      })
    },
    // 提示
    reminder() {
      wx.showToast({
        title: '功能开发中',
        icon: 'none',
        duration: 2000
      })
    },
    // 时间戳转时间
    timestampConversion(timestamp) {
      timestamp = parseInt(timestamp) * 1000
      let now = new Date(timestamp);
      let year = now.getYear();
      year = now.getFullYear();
      let month = now.getMonth() + 1;
      month = month < 10 ? "0" + month : month;
      let days = now.getDate();
      days = days < 10 ? "0" + days : days;
      let hour = now.getHours();
      hour = hour < 10 ? "0" + hour : hour;
      let minutes = now.getMinutes();
      minutes = minutes < 10 ? "0" + minutes : minutes;
      let seconds = now.getSeconds();
      seconds = seconds < 10 ? "0" + seconds : seconds;
      return year + "-" + month + "-" + days + "  " + hour + ":" + minutes + ":" + seconds;
    }
  }
}